/**
 * Created by zaranengap on 2017/7/3.
 */
import {combineReducers} from 'redux';
import {cr} from 'share/utils'
import {
  SET_USER,
  SET_PROFILE,
  SET_LOGIN_PROFILE,
  SET_LOGIN_USER,
  SET_TENANTPROFILE,
  SET_COMPANY,
  SET_LOGIN_COMPANY,
  SET_DOCUMENTARY_COMPANY,
  SET_USER_ORGANIZATION,
  SET_USER_PERMISSION,
  SET_USER_PERMISSION_ALL_MENUS,
  SET_NEW_PERMISSION_SORTED_MENUS,
  SET_COMPANY_CONFIGURATION,
  SET_IS_OLD_COMPANY,
  SET_LANGUAGE_LIST,
  SET_TENANT,
  SET_SETTING_STATUS,
  SET_VOICE_CODE_ENABLE,
  SET_LOGIN_OPTIONS,
  SET_OPTIONS
} from 'actions/login'

export default combineReducers({
  user: cr({}, {
    [SET_USER](state, {user}){return user}
  }),
  loginUser: cr({}, {
    [SET_LOGIN_USER](state, {loginUser}){return loginUser}
  }),
  profile: cr({}, {
    [SET_PROFILE](state, {profile}){return profile}
  }),
  loginProfile: cr({}, {
    [SET_LOGIN_PROFILE](state, {loginProfile}) {
      return loginProfile
    }
  }),
  tenantProfile: cr({}, {
    [SET_TENANTPROFILE](state, {tenantProfile}){return tenantProfile}
  }),
  company: cr({}, {
    [SET_COMPANY](state, {company}){return company}
  }),
  loginCompany: cr({}, {
    [SET_LOGIN_COMPANY](state, {loginCompany}){return loginCompany}
  }),
  documentaryCompany: cr({}, {
    [SET_DOCUMENTARY_COMPANY](state, {documentaryCompany}) {
      return documentaryCompany
    }
  }),
  tenant: cr({}, {
    [SET_TENANT](state, {tenant}){return tenant}
  }),
  organization: cr({}, {
    [SET_USER_ORGANIZATION](state, {organization}){return organization}
  }),
  companyConfiguration: cr({}, {
    [SET_COMPANY_CONFIGURATION](state, {companyConfiguration}){return companyConfiguration}
  }),
  userPermission: cr({}, {
    [SET_USER_PERMISSION](state, {userPermission}){return userPermission}
  }),
  userPermissionAllMenus: cr({}, {
    [SET_USER_PERMISSION_ALL_MENUS](state, {userPermissionAllMenus}){return userPermissionAllMenus}
  }),
  newPermissionSortedMenus: cr([], {
    [SET_NEW_PERMISSION_SORTED_MENUS](state, {newPermissionSortedMenus}){return newPermissionSortedMenus}
  }),
  isOldCompany: cr({}, {
    [SET_IS_OLD_COMPANY](state, {isOldCompany}){return isOldCompany}
  }),
  languageList: cr([], {
    [SET_LANGUAGE_LIST](state, {languageList}){return languageList}
  }),
  settingStatus: cr([], {
    [SET_SETTING_STATUS](state, {settingStatus}){return settingStatus}
  }),
  voiceCodeEnable: cr(false, {
    [SET_VOICE_CODE_ENABLE](state, {voiceCodeEnable}){return voiceCodeEnable}
  }),
  loginOptions: cr({}, {
    [SET_LOGIN_OPTIONS](state, {loginOptions}){return loginOptions}
  }),
  options: cr({}, {
    [SET_OPTIONS](state, {options}){return options}
  })
})
